home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SoundMaker 2003 (Professional Edition)
/
SoundMaker 2003 - Professional Edition.iso
/
midi tool
/
midioxse.exe
/
DATA.1
/
VBSDemo.vbs
< prev
next >
Wrap
Text File
|
1999-11-26
|
4KB
|
164 lines
' MIDIOX Test - Event Sink Example
' Copyright (c) 2000 by Jamie O'Connell
'
' This script is an example of doing VBScript with MIDI-OX
option explicit
dim mox
dim str, strWrk
dim n, ii, nInst
dim bGo
' Wsh version
Str = Wscript.Name & " ver. " & Wscript.Version
MsgBox str
' Create object
Set mox = WScript.CreateObject("MoxKart.MoxWire.1", "Tester_") ' make VB construct an input handler (below)
str = "MIDI-OX"
n = mox.NumberInstances
If n > 0 Then
str = str & ":" & CStr( n )
Else
MsgBox "No Instances"
End If
str = str & " "
str = str & mox.GetAppVersion
MsgBox str
If n > 0 then
nInst = 1
If n > 1 then
nInst = InputBox( "Attach to which instance? (1 to " & n & ")", "Attach", "1" )
End If
If mox.AttachInstance( nInst ) = 1 Then
MsgBox "Attached Instance: " & nInst
Else
MsgBox "Could not Attach Instance: " & nInst
End If
ElseIf vbYes = MsgBox( "Launch MIDI-OX?", vbYesNo + vbQuestion, "Launch" ) Then
If mox.LaunchInstance = 1 Then
nInst = 1
If mox.AttachInstance( nInst ) = 1 Then
MsgBox "Launched and Attached Instance: " & nInst
Else
MsgBox "Launched but could not Attach Instance: " & nInst
End If
Else
MsgBox "Launch MIDI-OX Failed"
End If
n = mox.NumberInstances
End if
' *** System devices
str = "Sys MIDI In Devices: " & mox.NumSysMidiIn
strWrk = mox.GetFirstSysMidiInDev
Do while strWrk <> ""
str = str & vbCrLf & " " & strWrk
strWrk = mox.GetNextSysMidiInDev
Loop
MsgBox Str
str = "Sys MIDI Out Devices: " & mox.NumSysMidiOut
strWrk = mox.GetFirstSysMidiOutDev
Do while strWrk <> ""
str = str & vbCrLf & " " & strWrk
strWrk = mox.GetNextSysMidiOutDev
Loop
MsgBox Str
' *** MIDI-OX devices
If mox.IsAttached = 1 then
str = "Open MIDI In Devices: " & mox.NumOpenMidiIn
strWrk = mox.GetFirstOpenMidiInDev
Do while strWrk <> ""
str = str & vbCrLf & " " & strWrk
strWrk = mox.GetNextOpenMidiInDev
Loop
MsgBox Str
str = "Open MIDI Out Devices: " & mox.NumOpenMidiOut
strWrk = mox.GetFirstOpenMidiOutDev
Do while strWrk <> ""
str = str & vbCrLf & " " & strWrk
strWrk = mox.GetNextOpenMidiOutDev
Loop
MsgBox Str
End if
' Send a SysEx string
If mox.IsAttached = 1 then
If vbYes = MsgBox( "Send SysEx String?", vbYesNo + vbQuestion, "Sysx String" ) Then
strWrk = "F0 41 10 42 11 48 00 00 00 1D 10 0B F7"
mox.SendSysExString strWrk
MsgBox "Done String: " & strWrk
End If
End If
' *** Try out our MIDI Sink
If mox.IsAttached = 1 then
If vbYes = MsgBox( "Divert MIDI Input?", vbYesNo + vbQuestion, "MIDI Notes" ) Then
mox.DivertMidiInput = 1
Else
mox.DivertMidiInput = 0
End If
mox.FireMidiInput = 1
MsgBox "Press OK to end MIDI Loop"
mox.FireMidiInput = 0
mox.DivertMidiInput = 0
End If
MsgBox "End Demo"
Set str = nothing
Set strWrk = nothing
Set mox = nothing
' Exit Point
'------------------------------------------
Sub Tester_MidiInput( ts, stat, chan, dat1, dat2)
dim newstat
newstat = stat + chan
If mox.DivertMidiInput = 0 Then
If stat = &h90 Or stat = &h80 Then
chan = chan + 1
If chan > 15 Then
chan = 0
End If
End If
newstat = stat + chan ' send out next chan
End If
mox.OutputMidiMsg newstat, dat1, dat2
End Sub
'------------------------------------------
' connection point sink for SysEx
Sub Tester_SysExInput( strSysEx )
mox.SendSysExString strSysEx
End Sub
'------------------------------------------
Sub Tester_OnTerminateMidiInput()
MsgBox "MIDI Input Termination Received From MIDI-OX"
mox.FireMidiInput = 0
mox.DivertMidiInput = 0
End Sub